<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../../../static/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../../static/js/jquery.js"></script>
<script type="text/javascript" src="../../../static/js/getParameter.js"></script>
<script type="text/javascript" src="../../../static/js/getProvinceAmdCity.js"></script>
<script type="text/javascript">
  let user = JSON.parse(localStorage.getItem("user"));
  var firm = {
    firmId:getParameter("firmId"),
    firmFounder:null,
    firmTel:null,
    firmAddress:null,
    pid:null,
    firmCity:null,
    firmContent:null,
    status:null,
    createId:user.uid,
    createName:null
  };

  function getParamCFU() {
    firm = {
      firmId:getParameter("firmId"),
      firmFounder:$("#cfuFounder").val(),
      firmTel:$("#cfuTel").val(),
      firmAddress:$("#cfuAddress").val(),
      pid:$("#cfuProvince").val(),
      firmCity:$("#cfuCity").val(),
      firmContent:$("#cfuContext").val(),
      status:$("#cfuStatus").val(),
      createId:user.uid,
      createName:$("#cfuCreateTime").val()
    };
  }

  function findOneFirm(){
    let firmId = getParameter("firmId");
    $.ajax({
      url: "/manufacturer/findOneFirm",
      method: "post",
      data:{firmId:firmId},
      dataType: "JSON",
      success:function (rel) {
        $("#cfuName").val(rel.data.firmName);
        $("#cfuFounder").val(rel.data.firmFounder);
        $("#cfuTel").val(rel.data.firmTel);
        $("#cfuAddress").val(rel.data.firmAddress);
        $("#cfuProvince").val(rel.data.pid);
        provinceChange();
        $("#cfuCity").val(rel.data.firmCity);
        $("#cfuContext").val(rel.data.firmContent);
        $("#cfuStatus").val(rel.data.status);
        $("#cfuCreateName").val(rel.data.createName);
        $("#cfuCreateTime").val(rel.data.createTime);
      }
    })
  }
  $(function () {
    getAddressInfo(findOneFirm);
  })

  function updateFirm() {
    getParamCFU()
    var isTrue = confirm("是否修改");
    if (isTrue) {
      $.ajax({
        url: "/manufacturer/updateProductFirm",
        method: "post",
        data:firm,
        dataType: "JSON",
        success:function (rel) {
          if (rel.data) {
            window.location.href="cflist";
          }
        }
      })
    }
  }


</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>采购管理</li>
    <li>厂商管理</li>
    <li>修改</li>
  </ul>
</div>
<div class="formbody">
  <div class="formtitle"><span>厂商信息</span></div>
  <ul class="forminfo">
    <li>
      <label>厂商名称</label>
      <input id="cfuName" type="text" value="阿里巴巴" class="dfinput" />
      <i>必填，不能超过50个字符</i>
    </li>
    <li>
      <label>负责人</label>
      <input id="cfuFounder" type="text" value="马云" class="dfinput" />
       <i>必填，不能超过30个字符</i>
    </li>
    <li>
      <label>联系方式</label>
      <input id="cfuTel" type="text" value="17370899727" class="dfinput" />
       <i>必填，不能超过30个字符</i>
    </li>
    <li>
      <label>联系地址</label>
      <input id="cfuAddress" type="text" value="江苏南京苏铺路180号泸州花园7栋3单元1801室" class="dfinput" />
       <i>必填，不能超过130个字符</i>
    </li>
    <li id="cfuAreaLi">
      <label>所属区域</label>
      <select id="cfuProvince" class="dfProvince" onchange="provinceChange()">
          <option>请选择</option>
<!--          <option>北京</option>-->
<!--          <option selected="selected">江苏</option>-->
<!--          <option>天津</option>-->
      </select>
      省
      <select id="cfuCity" class="dfCity">
          <option>请选择</option>
<!--          <option>北京</option>-->
<!--          <option selected="selected">南京</option>-->
<!--          <option>天津</option>-->
      </select>
      市
      <i>必选</i>
    </li>
    <li>
      <label>描述</label>
      <textarea id="cfuContext" class="textinput">阿里巴巴上市公司</textarea>
      <i>可选</i>
    </li>
    <li>
      <label>状态</label>
      <select id="cfuStatus" class="dfselect">
          <option value="1">可用</option>
          <option value="0">不可用</option>
        </select>
      <i>必选</i>
    </li>
    <li>
      <label>创建人</label>
      <input id="cfuCreateName" type="text" value="曹操" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>创建时间</label>
      <input id="cfuCreateTime" type="text" value="2017-11-18 15:36:10" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>&nbsp;</label>
      <input name="" type="button" class="btn" value="确定" onclick="updateFirm()"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="" type="button" class="btn" value="返回" onclick="window.location.href='cflist'"/>
    </li>
  </ul>
</div>
</body>
</html>
